package com.leaves.common.publicmethod.entity;

import cn.hutool.core.util.ObjectUtil;

/**
 * @Author: LEAVES
 * @Version 1.0
 * @Date: 2022年05月04日  18时03分24秒
 * @Description: 分页实体
 */
public class PageEntity {

    /**
     * 页码【默认第 1 页】
     */
    private Integer pageNumber = 1;

    /**
     * 条数【默认每页10条】
     */
    private Integer pageSize = 10;

    public PageEntity(Integer pageNumber, Integer pageSize) {
        this.pageNumber = pageNumber;
        this.pageSize = pageSize;
    }

    public Integer getPageNumber() {
        if (ObjectUtil.isNull(pageNumber)) {
            this.pageNumber = 1;
        }
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public Integer getPageSize() {
        if (ObjectUtil.isNull(pageSize)) {
            this.pageSize = 10;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    @Override
    public String toString() {
        return "PageEntity{" +
                "pageNumber=" + pageNumber +
                ", pageSize=" + pageSize +
                '}';
    }

}
